- /* sffffmul.cpp by K.Tsuru */
- // function ID = 712 DRADIX
- /*************************************
- SFraction class
- It provides the multiplication "x*y".
- (x.num/x.den)*(y.num/y.den)
- *************************************/
- #ifndef SN_H
- #include "sn.h"
- #endif
-
- SFraction FFMult(const SFraction& x, const SFraction& y){
- SFraction z; // z.reduceDone = false;
- if(x.Sign(712) == 0){
- z.SetZero(); return z;
- }
- #if REDUCE_SIZE==0
- SLong d1 = gcdL(x.num, y.den), d2 = gcdL(x.den, y.num);
- z.num = (x.num/d1)*(y.num/d2); z.den = (x.den/d2)*(y.den/d1);
- z.reduceDone = true;
- #else
- if(x.ReduceStepByStep()) {
- SLong d1 = gcdL(x.num, y.den), d2 = gcdL(x.den, y.num);
- z.num = (x.num/d1)*(y.num/d2); z.den = (x.den/d2)*(y.den/d1);
- z.reduceDone = true;
- } else {
- z.num = x.num*y.num; z.den = x.den*y.den;
- z.reduce(false);
- }
- #endif
- return z;
- }
sffffmul.cpp : last modifiled at 2017/10/20 10:44:47(884 bytes)
created at 2015/12/22 16:07:29
The creation time of this html file is 2017/10/21 15:10:35 (Sat Oct 21 15:10:35 2017).